package com.luoqiu.springCloud.controller;

import com.luoqiu.entities.Payment;
import com.luoqiu.entities.Result;
import com.luoqiu.springCloud.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 洛秋y
 * @date 2020/11/9 13:18
 */
@RestController
@Slf4j
public class PaymentController {

    @Resource
    private PaymentService paymentService;

    @GetMapping(value = "/get")
    public Result<Payment> get() {
        Payment payment = paymentService.get();
        return Result.success(payment);
    }

    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody Payment payment) {
        paymentService.add(payment);
        return Result.success("ok");
    }
}
